<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<f:loadBundle basename="com.es.resource.messages" var="bundle" />
<f:loadBundle basename="com.es.resource.BusinessRules" var="bundleBR" />

<html>
	<head>
		<base href="<%=basePath%>">

		<title>CREATE CONTACT</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<f:view>

			<a4j:form style="align: left;">

				<h:commandLink id="cl1" value="Log Out"
					action="#{authenticationController.logout}" immediate="true">
				</h:commandLink>

				<rich:spacer width="11"></rich:spacer>

				<h:commandLink id="cl2" value="Back to Dashboard"
					action="#{leadController.navigateToSalesAgentDashboard}"
					immediate="true">
				</h:commandLink>

				<h:inputHidden id="ih" value="#{contactController.tempVar}"></h:inputHidden>

				<rich:panel id="panel" header="#{bundle.CREATE_CONTACT_HEADER}"
					style="width: 900px; height: 900px;">

					<h:outputText value="#{bundle.CREATE_CONTACT_INPUT_PROMPT_MSG }" />

					<h:form id="createContactFormId"
						style="height: 673px; width: 695px">

						<rich:messages globalOnly="true"></rich:messages>

						<table border="0" cellpadding="0" cellspacing="10" width="100%">

							<tr align="right">
								<td>

									<h:outputLabel for="contactType" value="type"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:selectOneMenu id="contactType"
										value="#{contactController.contact.type}">


										<f:selectItems
											value="#{contactController.contactTypeSelectItems}" />
									</h:selectOneMenu>

								</td>

							</tr>

							<tr>
								<td width="25%" align="right">
									<h:outputLabel for="firstname" value="firstname"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>
								</td>
								<td width="75%" align="left">
									<h:inputText value="#{contactController.contact.firstname}"
										id="firstname" label="firstname" required="true"
										requiredMessage=" Firstname is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">
										<a4j:support id="firstName" event="onblur"
											reRender="fnameErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="fnameErrMsg" for="firstname" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>

								</td>


							</tr>

							<tr align="left">

								<td width="10%" align="right">
									<h:outputLabel for="lastname" value="lastname"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td width="60%">

									<h:inputText value="#{contactController.contact.lastname}"
										id="lastname" label="lastname" required="true"
										requiredMessage=" Lastname is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="lastName" event="onblur"
											reRender="lnameErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="lnameErrMsg" for="lastname" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>

								</td>

							</tr>

							<tr align="left">

								<td width="10%" align="right">
									<h:outputLabel for="accountname" value="account name"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td width="60%">

									<h:inputText value="#{contactController.contact.accountname}"
										id="accountname" label="lastname"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">
									</h:inputText>


								</td>

							</tr>

							<tr align="left">

								<td width="10%" align="right">
									<h:outputLabel for="vendorname" value="vendor name"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td width="60%">

									<h:inputText value="#{contactController.contact.vendorname}"
										id="vendorname" label="vendorname"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">
									</h:inputText>


								</td>

							</tr>



							<tr align="left">
								<td align="right">
									<h:outputLabel for="email" value="email"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>
								</td>

								<td>
									<h:inputText value="#{contactController.contact.email}"
										id="email" label="email"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="title" value="title"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="title"
										value="#{contactController.contact.title}" label="title"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="department" value="department"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="department"
										value="#{contactController.contact.department}"
										label="department"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>

							</tr>




							<tr align="right">
								<td>
									<h:outputLabel for="phone" value="phone"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="phone"
										value="#{contactController.contact.phone}" label="phone"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>

							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="homephone" value="home phone"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="homephone"
										value="#{contactController.contact.homephone}"
										label="homephone"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>

							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="otherphone" value="other phone"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="otherphone"
										value="#{contactController.contact.otherphone}"
										label="otherphone"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>

							</tr>



							<tr align="right">
								<td>
									<h:outputLabel for="mobile" value="mobile"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="mobile"
										value="#{contactController.contact.mobile}" label="mobile"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="fax" value="fax"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="fax" value="#{contactController.contact.fax}"
										label="fax"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>







							<tr align="right">
								<td>
									<h:outputLabel for="assistant" value="assistant"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="assistant"
										value="#{contactController.contact.assistant}"
										label="assistant"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>


								</td>

							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="assistPhone" value="assist phone"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="assistPhone"
										value="#{contactController.contact.assistphone}"
										label="assistPhone"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>
							<tr align="right">
								<td>
									<h:outputLabel for="reportsTo" value="reports to"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="reportsTo"
										value="#{contactController.contact.reportsto}"
										label="reportsTo"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>
							<tr align="right">
								<td>
									<h:outputLabel for="liveID" value="liveID"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="liveID"
										value="#{contactController.contact.liveid}" label="liveID"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>


							<rich:spacer height="15"></rich:spacer>


							<tr align="right">
								<td>

									<h:outputLabel for="mailingstreet" value="mailing street"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>


								<td align="left">

									<h:inputText id="mailingstreet"
										value="#{contactController.contact.mailingstreet}"
										label="mailingstreet" required="true"
										requiredMessage=" Street address is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="streeta4j" event="onblur"
											reRender="streetErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="streetErrMsg" for="mailingstreet"
										passedLabel="*" style='color:red; font-size: 11px;'
										showDetail="false" showSummary="true"></rich:message>



								</td>
							</tr>



							<tr align="left">
								<td align="right">
									<h:outputLabel for="mailingcity" value="mailingcity"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{contactController.contact.mailingcity}"
										id="mailingcity" required="true"
										requiredMessage=" City is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">


										<a4j:support id="citya4j" event="onblur" reRender="cityErrMsg"
											ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="cityErrMsg" for="mailingcity" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>


								</td>
							</tr>





							<tr align="left">
								<td align="right">
									<h:outputLabel for="mailingstate" value="mailing state"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{contactController.contact.mailingstate}"
										id="mailingstate" required="true"
										requiredMessage=" State is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="statea4j" event="onblur"
											reRender="stateErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="stateErrMsg" for="mailingstate"
										passedLabel="*" style='color:red; font-size: 11px;'
										showDetail="false" showSummary="true"></rich:message>

								</td>
							</tr>


							<tr align="left">
								<td align="right">
									<h:outputLabel for="mailingcountry" value="mailing country"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText
										value="#{contactController.contact.mailingcountry}"
										id="mailingcountry" required="true"
										requiredMessage=" Country is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="countrya4j" event="onblur"
											reRender="countryErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="countryErrMsg" for="mailingcountry"
										passedLabel="*" style='color:red; font-size: 11px;'
										showDetail="false" showSummary="true"></rich:message>

								</td>
							</tr>




							<rich:spacer height="15"></rich:spacer>


							<tr align="right">
								<td>

									<h:outputLabel for="othersteet" value="other steet "
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:inputText id="othersteet"
										value="#{contactController.contact.othersteet}"
										label="othersteet"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>



							<tr align="left">
								<td align="right">
									<h:outputLabel for="othercity" value="other city"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{contactController.contact.othercity}"
										id="othercity"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>





							<tr align="left">
								<td align="right">
									<h:outputLabel for="otherstate" value="other state"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{contactController.contact.otherstate}"
										id="otherstate"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>
								</td>
							</tr>


							<tr align="left">
								<td align="right">
									<h:outputLabel for="othercountry" value="other country"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{contactController.contact.othercountry}"
										id="othercountry"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>

							<rich:spacer height="15"></rich:spacer>



							<tr align="left">
								<td align="right">
									<h:outputLabel for="description" value="description "
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{contactController.contact.description}"
										id="description"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>




							<tr align="left">
								<td>
								</td>

								<td align="left">

									<a4j:commandButton style="width: 108px"
										action="#{contactController.createContact}"
										value="Create Lead" reRender="finalMsg">
									</a4j:commandButton>

								</td>


							</tr>


						</table>
						<table>
							<tr align="left">

								<td width="100%">
									<h:outputLabel id="finalMsg" value=""
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>
							</tr>
						</table>
					</h:form>

				</rich:panel>
			</a4j:form>


		</f:view>
	</body>
</html>